package cn.gcjxsc.payment.service.wx;

import cn.gcjxsc.payment.entity.wx.RedPackRecord;
import cn.gcjxsc.payment.repository.wx.RedPackRecordRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author pumbaa
 * @since 1.0
 */
@Service
public class RedPackRecordService {

    @Autowired
    private RedPackRecordRepository recordRepository;

    @Transactional
    public List<RedPackRecord> saveOrUpdate(List<RedPackRecord> records) {
        return recordRepository.save(records);
    }

    @Transactional
    public RedPackRecord saveOrUpdate(RedPackRecord record) {
        return recordRepository.save(record);
    }

    public List<RedPackRecord> findBySn(String sn) {
        return recordRepository.findBySn(sn);
    }

    public RedPackRecord findBySnAndType(String sn, Integer type) {
        return recordRepository.findBySnAndType(sn, type);
    }
}
